package org.ayachinene.leetcode.problems;

public class P2319 {

    static class Solution {
        public boolean checkXMatrix(int[][] grid) {
            int n = grid.length;
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; j++) {
                    int cur = grid[i][j];
                    // 对角
                    if (i == j || i + j == n - 1) {
                        if (cur == 0) {
                            return false;
                        }
                    } else {
                        if (cur != 0) {
                            return false;
                        }
                    }
                }
            }
            return true;
        }
    }
}
